<#assign pageTitle = "课程评论" />
<#assign pageHeader>
	<script type="text/javascript" src="/static/js/comment/comment.js"></script>
<script>
	otherId = '${otherId}';
	var type = 2;
	$(function(){
		//左侧订单中心选中
		$("a[href$='/user/order/list.html']").parent().addClass("current");
	});
	// 添加评论
	function addComment() {
		// 评论必须先登陆
		isLogin(function () {
			// 评论
			var content = $("#commentContent").val().trim();
			// 评论内容不能为空
			if (content === "") {
				return layer.msg("内容不能为空！");
			}
			$.ajax({
				url: '/ajax/comment/add.json',
				type: 'post',
				data: {
					"parentId": "0",
					"content": content,
					"type": type,
					"otherId": otherId
				},
				dataType: 'json',
				success: function (result) {
					if (result.code === 0) {
						return layer.alert("恭喜您，评论发布成功,点击确定返回！", function () {
							location.href = "/user/order/list.html";
						});
					} else {
						return layer.msg(result.msg);
					}
				}
			});
		});
	}
</script>
</#assign>
<#assign pageContent>
	<article class="w80 fl">
		<div class="u-r-cont">
			<section>
				<div class="u-r-all-box">
					<section class="u-r-tit-all">
						<h2 class="clearfix">
							<span class="fsize16 c-333 f-fM unFw name">课程评价</span>
						</h2>
					</section>
					<section>
						<div class="clearfix cou-r-pl-all">
							<article class="w30 fl">
								<div class="cc-l-wrap mr20 ml20">
									<section class="course-img">
										<img class="img-responsive" xsrc="${course.cover}" src="${course.cover}" alt="初中教师资格证—教学知识与能力">
										<div class="cc-mask">
											<a class="comm-btn c-btn-1" href="/course/view/${course.courseId}.html" title="开始学习">开始学习</a>
										</div>
									</section>
									<div class="bg-f8 coure-bg-g">
										<h3 class="hLh30 txtOf">
											<a class="course-title fsize16 c-333" href="/course/view/${course.courseId}.html" title="${course.courseName}">${course.courseName}</a>
										</h3>
										<section class="mt10 hLh20 of">
											<span class="fl">
											<tt class="c-master fsize14 f-fM">￥${course.price/100}</tt>
											</span>
										</section>
									</div>
								</div>
							</article>
							<article class="w70 fl">

								<div class="cou-r-pl-r-box">
									<p class="hLh30 fsize16 c-666 f-fM">用户感受：</p>
									<section class="u-r-t-big">
										<textarea class="u-r-textarea" id="commentContent" maxlength="500" placeholder="请输入您对本课程的意见，以便于我们更好的为您提供服务！"></textarea>
									</section>
									<section class="tac mt20 u-o-right">
										<a class="cou-kscp gmkc" href="javascript:addComment();">发表评论</a>
									</section>
								</div>
							</article>
						</div>
					</section>
				</div>
			</section>
		</div>
	</article>
</#assign>
<#include "../layouts/layout_uc.ftl">